package com.yiibai.springmvc;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yiibai.springmvc.jms.queue.ConsumerService;
import com.yiibai.springmvc.jms.queue.ProducerService;

@Controller
public class JmsController {

	@Autowired
	private ProducerService producerService;
	
	@Autowired
	private ConsumerService consumerService;

	@RequestMapping("/jms/push/{msg}")
	@ResponseBody
	public Object push(@PathVariable("msg") String msg, Model model) {

		producerService.sendMessage(msg);

		return "ok";

	}
	

	@RequestMapping("/jms/recevice")
	@ResponseBody
	public Object recevice( Model model) {

		consumerService.receive(null);

		return "ok";

	}

}